|
Message passing is the mechanism by which objects communicate. Due to strong encapsulation, the data of one object cannot be accessed by another object directly. Instead, messages have to be exchanged between the objects. In general, messages which can be sent to an object are characterized by the methods of that object. Often, the methods of an object are called services. To send a message, the receiver object and the requested service have to be specified. (Possibly the parameters for the requested service have to be specified, too.) In the car example this can look like this: |
my_car.speed_up
my_car denotes the receiver object and speed_up specifies the requested service. Note: In literature the term message passing in not used with uniform semantics. Sometimes it is used with very special semantics, sometimes it is used as a general synonym for communication. |